//https://blog.csdn.net/u013453604/article/details/72903398
//其他包调用自定义msg类型
#include <ros/ros.h>
#include <rosmsg_template/simple.h>
#include <iostream>
using namespace std;
rosmsg_template::simple msg;	
int main(int argc,char ** argv)
{
  ros::init(argc,argv,"rosmsg_template");
  ros::NodeHandle n; 
    ros::Rate rate(10);
  char prekeys[20]={};
  ros::Publisher msg_pub = n.advertise<rosmsg_template::simple>("rosmsg_template", 10);
 while(ros::ok())
{
cin.getline(prekeys,20);
 //cout<<"prekey"<<*prekeys<<endl;
  for(int i=0;i<strlen(prekeys);i++)
 { msg.keystring[i]=prekeys[i];}
  
 // cout<<"circle"<<msg.keychar;
ROS_INFO("please sent the string command");
// ros::Subscriber msg_pub = n.subscribe("rosmsg_template", 10, msgCallback);
  
   msg_pub.publish(msg);
  //ros::spinOnce();

  rate.sleep();


}
  return 0;
}
